package com.cardone.platform.common.service;

import java.util.List;

import lombok.Getter;
import lombok.Setter;

import com.cardone.common.dto.PaginationDto;
import com.cardone.context.ContextHolder;
import com.cardone.platform.common.dao.EntityExtendDao;
import com.cardone.platform.common.dto.EntityExtendDto;

/**
 * 实体扩展服务
 *
 * @author yaohaitao
 *
 */
@Getter
@Setter
public class EntityExtendDefaultService implements EntityExtendService {
	@Override
	public int deleteByIds(final EntityExtendDto deleteEntityExtend) {
		return ContextHolder.getBean(EntityExtendDao.class).deleteByIds(deleteEntityExtend);
	}

	@Override
	public <P> P findByCodeOrId(final Class<P> mappedClass, final EntityExtendDto findEntityExtend) {
		return ContextHolder.getBean(EntityExtendDao.class).findByCodeOrId(mappedClass, findEntityExtend);
	}

	@Override
	public <P> P findById(final Class<P> mappedClass, final EntityExtendDto findEntityExtend) {
		return ContextHolder.getBean(EntityExtendDao.class).findById(mappedClass, findEntityExtend);
	}

	@Override
	public <P> List<P> findListByLikeCode(final Class<P> mappedClass, final EntityExtendDto findListEntityExtend) {
		return ContextHolder.getBean(EntityExtendDao.class).findListByLikeCode(mappedClass, findListEntityExtend);
	}

	@Override
	public int insertByCode(final EntityExtendDto insertEntityExtend) {
		return ContextHolder.getBean(EntityExtendDao.class).insertByCode(insertEntityExtend);
	}

	@Override
	public <P> PaginationDto<P> paginationByLikeCode(final Class<P> mappedClass, final EntityExtendDto paginationEntityExtend) {
		return ContextHolder.getBean(EntityExtendDao.class).paginationByLikeCode(mappedClass, paginationEntityExtend);
	}

	@Override
	public Integer readByCodeNqIdForCount(final EntityExtendDto readEntityExtend) {
		return ContextHolder.getBean(EntityExtendDao.class).readByCodeNqIdForCount(readEntityExtend);
	}

	@Override
	public <P> P saveByIdOrCode(final Class<P> mappedClass, final EntityExtendDto saveEntityExtend) {
		return ContextHolder.getBean(EntityExtendDao.class).saveByIdOrCode(mappedClass, saveEntityExtend);
	}

	@Override
	public int updateByCode(final EntityExtendDto updateEntityExtend) {
		return ContextHolder.getBean(EntityExtendDao.class).updateByCode(updateEntityExtend);
	}
}